package com.enzi.webclient;


import com.enzi.webclient.domian.User;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;


/**
 * @Author: enzi.cheng
 * @Date: 2019/1/15 09:07
 * @Description:
 */
@ApiServer("http://localhost:8080/user")
public interface IUserApi {

    /**
     * 获取学生信息
     * @return
     */
    @GetMapping("/")
    Flux<User> getAllUser();

    /**
     * 根据用户id查询用户
     * @param id
     * @return
     */
    @GetMapping("/{id}")
    Mono<User> getUserById(@PathVariable("id") String id);

    /**
     * 根据用户id删除用户
     * @param id
     * @return
     */
    @DeleteMapping("/{id}")
    Mono<User> deleteUserById(@PathVariable("id") String id);

    /**
     * 新增用户

     * @param user
     * @return
     */
    @PostMapping("/")
    Mono<User> createUser(@RequestBody Mono<User> user);


    /**
     * 修改用户
     *  @param id
     * @param user
     * @return
     */
    @PutMapping("/{id}")
    Mono<User> updateUser(@PathVariable("id") String id,@RequestBody Mono<User> user);

    /**
     * RequestParam
     * @param id
     * @return
     */
    @GetMapping("/request?id={id}")
    Mono<User> getUserByRequestParam(@RequestParam("id") String id);
}
